# -*- coding: utf-8 -*-
"""Main Controller"""

from tg import expose, flash, require, url, request, redirect
from pylons.i18n import ugettext as _, lazy_ugettext as l_

from lex.lib.base import BaseController
from lex.controllers.error import ErrorController
from lex.controllers.alfabetos_controlador import AlfabetosController
from lex.controllers.analizadores_controlador import AnalizadoresController
from lex.controllers.expresiones_controlador import ExpresionesController
from lex.controllers.cadenas_controlador import CadenasController
from lex.controllers.afns_controlador import AfnsController
from lex.controllers.afds_controlador import AfdsController
from lex.controllers.afdsops_controlador import AfdsopsController

__all__ = ['RootController']

class RootController(BaseController):
    """
    The root controller for the LEX application.

    All the other controllers and WSGI applications should be mounted on this
    controller. For example::

        panel = ControlPanelController()
        another_app = AnotherWSGIApplication()

    Keep in mind that WSGI applications shouldn't be mounted directly: They
    must be wrapped around with :class:`tg.controllers.WSGIAppController`.

    """

    error = ErrorController()
    alfabetos = AlfabetosController()
    analizadores = AnalizadoresController()
    expresiones = ExpresionesController()
    cadenas = CadenasController()
    afns = AfnsController()
    afds = AfdsController()
    afdsops = AfdsopsController()

    @expose('lex.templates.index')
    def index(self):
        """Handle the front-page."""
        return dict()

    @expose('lex.templates.admin')
    def admin(self):
        """Handle the 'about' page."""
        return dict()

    @expose('lex.templates.pruebas')
    def pruebas(self):
        """This method showcases TG's access to the wsgi environment."""
        return dict()
